import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

import junit.framework.TestCase;

public class TestThatStartTimeInOutputFile
    extends TestCase {
        public TestThatStartTimeInOutputFile(String name) {
            super(name);
        }
        public void test() {
            appointment ap = new appointment();
            // change fields
            ap.eventName.setText("Foo");
            ap.comboBox.setSelectedIndex(1);
            ap.comboBox_1.setSelectedIndex(2);
            ap.descriptionText.setText("Foobar");
            ap.setDateToToday();
            ap.btnNewButton.doClick();
            
            // read output file
            try {
    			BufferedReader br = new BufferedReader(new FileReader("test.ics"));
    			boolean found = false;
    			String line;
    			
    			while ((line = br.readLine()) != null) {
    				if (line.equals("DESCRIPTION:Foobar")) {
    					found = true;
    				}
    			}
    			assertEquals(true, found);
    		} catch (FileNotFoundException e) {
    			// TODO Auto-generated catch block
    			e.printStackTrace();
    		}
            //assertEquals("Hello World!", hi.say());
    		catch (IOException e) {
    			// TODO Auto-generated catch block
    			e.printStackTrace();
    		}
        }
        public static void main(String[] args) {
            junit.textui.TestRunner.run(
                TestThatEventFieldInOutputFile.class);
        }
}
